From 931a2bf97fa446879e3df8d8cd679a3d652ee707 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Fri, 18 Nov 2005 17:50:25 +0100 Subject: [PATCH] make_page_readonly() must flush unused kmaps when handling a high-memory page. Otherwise stale writable mappings may persist. This fixes a corner case for alloc_ldt (which can vmalloc an LDT and hence use highmem pages). Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c index 9182e0708e..d5782f9631 100644 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c @@ -409,7 +409,9 @@ void make_page_readonly(void *va) if ((unsigned long)va >= (unsigned long)high_memory) { unsigned long pfn = pte_pfn(*pte); #ifdef CONFIG_HIGHMEM - if (pfn < highstart_pfn) + if (pfn >= highstart_pfn) + kmap_flush_unused(); /* flush stale writable kmaps */ + else #endif make_lowmem_page_readonly( phys_to_virt(pfn << PAGE_SHIFT)); -- 2.30.2